<template>
    <div id="app">
        <router-view />
    </div>
</template>

<script>
import { GET_CURRENT_LOCATION, UPDATE_CITYS } from '@/store/actions.types';
import { SET_PLATFORM_ID, SET_START_CITY_OBJ } from '@/store/mutations.types';
import Utils from '@/common/pakjUtils';
import { mapGetters } from 'vuex';
import { Dialog } from 'mand-mobile';
export default {
    watch: {
        $route: 'initData'
    },
    methods: {
        initData() {
            let platformid = this.$route.query.platformid;
            if (platformid) {
                this.$store.commit(SET_PLATFORM_ID, platformid);
            }
            let openid = this.$route.query.oid;
            if (openid) {
                this.$store.commit('setOpenId', openid);
            }
            let unionid = this.$route.query.uid;
            if (unionid) {
                this.$store.commit('setUnionId', unionid);
            }
        }
    },
    beforeCreate() {
        if (!Utils.isApp()) {
            this.$store
                .dispatch(GET_CURRENT_LOCATION)
                .then(() => {
                    let city = {
                        start_route: this.getCurrentLocation.provinceName,
                        type: '1'
                    };
                    this.$store.commit(SET_START_CITY_OBJ, city);
                })
                .catch(reason => {
                    console.error('当前浏览器没有位置权限', reason.message);
                });
        }
    },
    computed: {
        ...mapGetters(['getCurrentLocation'])
    }
};
</script>

<style lang="stylus">
#app {
    font-family: 'Avenir', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: color-text-base;
    overflow-x: hidden;
}

body {
    margin: 0;
    padding: 0;
    background-color: #ffffff;
}

ul {
    list-style-type: none;
    padding-inline-start: 0px;
    margin-block-start: 0px;
    margin-block-end: 0px;
}

input::-webkit-input-placeholder {
    color: #999;
}

img {
    content: normal !important;
}
</style>
